#include <iostream>

using namespace std;

int main()
{
    int L, R;
    cin >> L >> R;
    int sum = 0;
    for (int i = L; i <= R; i++)
    {
        int tmp = i;
        while (tmp)
        {
            if (tmp % 10 == 2)
                sum++;
            tmp /= 10;
        }
    }
    cout << sum << endl;
    return 0;
}